package org.core.tliaswebmanagement.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.core.tliaswebmanagement.pojo.Clazz;
import org.core.tliaswebmanagement.pojo.ClazzQueryParam;

import java.util.List;

@Mapper
public interface ClazzMapper {

    @Select("select * from clazz order by update_time desc")
    List<Clazz> findAll();

    List<Clazz> list(ClazzQueryParam param);

    @Delete("delete from clazz where id=#{id}")
    void deleteById(Integer id);

    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time) "+
            "values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void insert(Clazz clazz);

    void updateById(Clazz clazz);

    @Select("select * from clazz where id=#{id}")
    Clazz getById(Integer id);
}
